{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "# 7.2 L, L over D and K from Kv for Conventional Type Valves"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "A 150 mm class 125 Y-pattern globe valve with a Kv=500 flow coefficient is given.\n",
    "\n",
    "Calculate the resistance coefficient K, L/D equivalent, and the length for complete turbulence in the flow.\n",
    "\n",
    "Use schedule 40, 150 mm pipe as a reference."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false,
    "execution": {
     "iopub.execute_input": "2022-08-22T01:19:46.259300Z",
     "iopub.status.busy": "2022-08-22T01:19:46.258868Z",
     "iopub.status.idle": "2022-08-22T01:19:46.885721Z",
     "shell.execute_reply": "2022-08-22T01:19:46.885019Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loss coefficient = 3.5996713983999995 dimensionless\n",
      "Equivalent length = 239.97809322666663 dimensionless\n",
      "Length for complete turbulence = 36.95662635690666 meter\n"
     ]
    }
   ],
   "source": [
    "from fluids.units import *\n",
    "D = .154*u.m\n",
    "Kv = 500*u.m**3/u.hour\n",
    "\n",
    "K = Kv_to_K(Kv, D)\n",
    "L_D = L_equiv_from_K(K, fd=.015)\n",
    "L = D*L_D\n",
    "\n",
    "print('Loss coefficient = %s' %K)\n",
    "print('Equivalent length = %s' % L_D)\n",
    "print('Length for complete turbulence = %s' %L)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The results calculated in Crane TP 410M are  3.6, 240, and 37.0 respectively."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
